-compile({i, "../../.."}).
-include_lib("ect/include/ect.hrl").

-class(alpha).
-version(2).
?FIELDS(2, private, {c, a}).
?FIELDS(2, public, {pub1, flag = okay}).

-methods([get_all_v2/1, upgrade/2, alpha_version/1]).

get_all_v2(#alpha{a = A, pub1 = Pub1, c = C}) ->
    {A, C, Pub1}.

alpha_version(_This) ->
    v2.

?FIELDS(1, private, {a, b}).
?FIELDS(1, public, {pub1, flag = okay}).
?FIELDS(1, private, {c}).
upgrade(New, Old) ->
    case ectv_get_local_version(Old) of
    1 ->
        ectv_match(1, {a = A, b = B, c = C, pub1 = Pub1}, Old),
        New#alpha{a = upgraded, c = {A, B, C}, pub1 = Pub1, flag = okay}
    end.